package com.fesine.ssh.model;

import javax.persistence.*;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;


/**
 * 定单实体类
 * @author fesine
 */
@Entity
@Table(name="t_sales_order")
public class SalesOrder extends BasePo {
	/**
	 * 定单编号
	 * 格式为201211230001,201211230002
	 */
	private String orderId;
	/**
	 * 用户名（哪位用户下的单子）
	 */
	private String username;//userid int

	/**用户的电话号码*/
	private String phone;//

	/**用户的QQ号码*/
	private String qq;
	/**
	 * 送货地址
	 */
	private String address;
	/**
	 * 定单创建日期
	 */
	private Date ordDate;


	/**
	 * 定单总价
	 */
	private double totalPrice;
	/**
	 * 定单修改日期
	 */
	private Date updateDate;
	/**
	 * 定单状态：审核通过，未通过
	 */
	private Integer status;
	/**是否为作废单子 true表示为有效，false表示为作废*/
	private Integer nullify;
	/**
	 * 备注
	 */
	private String remark;
	/**
	 * 一个订单包含那些项
	 * 一对多的关系
	 */
	private Set<SaleItem> saleItems = new HashSet<SaleItem>();

	public String getOrderId() {
		return orderId;
	}

	public void setOrderId(String orderId) {
		this.orderId = orderId;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getQq() {
		return qq;
	}

	public void setQq(String qq) {
		this.qq = qq;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public Date getOrdDate() {
		return ordDate;
	}

	public void setOrdDate(Date ordDate) {
		this.ordDate = ordDate;
	}

	public double getTotalPrice() {
		return totalPrice;
	}

	public void setTotalPrice(double totalPrice) {
		this.totalPrice = totalPrice;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getNullify() {
		return nullify;
	}

	public void setNullify(Integer nullify) {
		this.nullify = nullify;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
	@JoinColumn(name="salesOrderId",referencedColumnName = "orderId")
	public Set<SaleItem> getSaleItems() {
		return saleItems;
	}
	public void setSaleItems(Set<SaleItem> saleItems) {
		this.saleItems = saleItems;
	}
	
	
}
